<?php
/* ========== ########## ========== ########## ========== ########## ========== */
/*                                                                              */
/*   WHMCS v4.1.2 NULLED R4 by FLIPMODE  [ BAD SYNTAX ]                         */
/*                                                                              */
/*                             INTERNAL BAD SYNTAX NULLED VERSION: 2.5.9.6 R4   */
/*                                                                              */
/*   ALL files have been analysed, cleaned and nulled of:                       */
/*     - Call Backs  (100%)                                                     */
/*     - Link Backs (95%)                                                       */
/*     - Licensing  (100%)                                                      */
/*     - Remote Links + URL's                                                   */
/*                                                                              */
/*   WHMCS v4.1.2 RELEASED: 4th November 2009                                   */
/*    -> FIRST v4.1.2 NULL R1: 19th November 2009                               */
/*    -> UPDATED v4.1.2 NULL R4: 27th November 2009                             */
/*                                                                              */
/*   TESTING + VERIFICATION::                                                   */
/*     Files Cleaned, Nulled, Checked, Verified By:                             */
/*      -> FLIPMODE!                                                            */
/*     Decoded By:                                                              */
/*      -> FLIPMODE! + Unknown Decoder                                          */
/*     Tested By:                                                               */
/*      -> FLIPMODE!, LeetWolf, and 12 Anonymous Users...                       */
/*     WHMCS 4.1.2 Supplied By:                                                 */
/*      -> WHM CompleteShit Coder @ WHMCS.com                                   */
/*                                                                              */
/*                                                                              */
/*   IMPORTANT NOTE::                                                           */
/*   PLEASE NOTE THIS IS FOR TRIAL PURPOSES ONLY!                               */
/*                          LIKE IT? THEN BUY IT!                               */
/*                                                                              */
/* ========== ########## ========== ########## ========== ########## ========== */

function initialiseclientarea ($pagetitle, $pageicon, $breadcrumbnav)
{
	global $CONFIG;
	global $_LANG;
	global $templates_compiledir;
	global $in_ssl;
	global $clientsdetails;
	global $smarty;
	global $smartyvalues;
	include_once ROOTDIR . '/includes/smarty/Smarty.class.php';
	$smarty = new Smarty ();
	$smarty->caching = 0;
	$smarty->template_dir = 'templates/';
	$smarty->compile_dir = $templates_compiledir;
	$filename = $_SERVER['PHP_SELF'];
	$filename = substr ($filename, strrpos ($filename, '/'));
	$filename = str_replace ('/', '', $filename);
	$filename = explode ('.', $filename);
	$filename = $filename[0];
	$smarty->assign ('template', $CONFIG['Template']);
	$smarty->assign ('language', $CONFIG['Language']);
	$smarty->assign ('LANG', $_LANG);
	$smarty->assign ('companyname', $CONFIG['CompanyName']);
	$smarty->assign ('charset', $CONFIG['Charset']);
	$smarty->assign ('pagetitle', $pagetitle);
	$smarty->assign ('pageicon', $pageicon);
	$smarty->assign ('filename', $filename);
	$smarty->assign ('breadcrumbnav', $breadcrumbnav);
	$smarty->assign ('todaysdate', date ('l, jS F Y'));
	$smarty->assign ('currency', $CONFIG['Currency']);
	$smarty->assign ('currencysymbol', $CONFIG['CurrencySymbol']);
	if ($CONFIG['SystemSSLURL'])
	{
		$smarty->assign ('systemsslurl', $CONFIG['SystemSSLURL'] . '/');
	}

	if (($in_ssl AND $CONFIG['SystemSSLURL']))
	{
		$smarty->assign ('systemurl', $CONFIG['SystemSSLURL'] . '/');
	}
	else
                                     /* Do not change this URL!!! - Flipmode! */
	{
		if ($CONFIG['SystemURL'] != 'http://www.yourdomain.com/whmcs')
		{
			$smarty->assign ('systemurl', $CONFIG['SystemURL'] . '/');
		}
	}

	if ($_SESSION['uid'])
	{
		$smarty->assign ('loggedin', true);
		require_once ROOTDIR . '/includes/clientfunctions.php';
		$smarty->assign ('clientsdetails', getclientsdetails ());
		$smarty->assign ('clientsstats', getclientsstats ($_SESSION['uid']));
	}

	if ($CONFIG['AllowLanguageChange'] == 'on')
	{
		$smarty->assign ('langchange', 'true');
	}

	$setlanguage = '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="languageform"><strong>' . $_LANG['language'] . ':</strong> <select name="language" onchange="languageform.submit()">';
	$dh = opendir ('lang/');
	while (false !== $file2 = readdir ($dh))
	{
		if (!is_dir ('' . 'lang/' . $file2))
		{
			$pieces = explode ('.', $file2);
			if ($pieces[1] == 'txt')
			{
				$piece = $pieces[0];
				$setlanguage .= ('' . '<option value="' . $piece . '"');
				if ((isset ($_SESSION['Language']) AND $_SESSION['Language'] == $piece))
				{
					$setlanguage .= ' selected="selected"';
				}
				else
				{
					if (!isset ($_SESSION['Language']))
					{
						if ($piece == $CONFIG['Language'])
						{
							$setlanguage .= ' selected="selected"';
						}
					}
				}

				$setlanguage .= '' . '>' . $piece . '</option>';
				continue;
			}

			continue;
		}
	}

	closedir ($dh);
	$setlanguage .= '</select></form>';
	$smarty->assign ('setlanguage', $setlanguage);
	$currenciesarray = array ();
	$result = select_query ('tblcurrencies', 'id,code', '', 'code', 'ASC');
	while ($data = mysql_fetch_array ($result))
	{
		$currenciesarray[] = array ('id' => $data['id'], 'code' => $data['code']);
	}

	if (count ($currenciesarray) == 1)
	{
		$currenciesarray = '';
	}

	$smarty->assign ('currencies', $currenciesarray);
	$smartyvalues = array ();
}

function outputclientarea ($templatefile)
{
	global $CONFIG;
	global $smarty;
	global $smartyvalues;
	global $orderform;
	global $usingsupportmodule;
	global $licensing;
	global $customadminpath;
	if ($licensing->getBrandingRemoval ())
	{
		$copyrighttext = '';
	}
	else
	{
		$copyrighttext = '<p align="center"><font size="1" color="#666666">You have not followed the instructions, modified something to cause this problem, mixed files from different versions, not upgraded properly.<br />Please Re-Run the Activator (if your version requires it) or re-upload the original files, or re-download them from www.Yagbu.net forum.<br /><br /><font size="1" color="#666666">Copyright &copy; WHMCompleteSolution <b>|</b> WHMCS v4.1.2<sup>r3</sup> Nulled by Flipmode! + Many Others, October 2009.&nbsp; All Rights Reserved.</font></p>';
	}

	if ($_SESSION['adminid'])
	{
		$adminloginlink = '

<div style="position:absolute;top:0px;right:0px;padding:5px;background-color:#000066;font-family:Tahoma;font-size:11px;color:#ffffff">Logged in as Administrator | <a href="' . $customadminpath . '/';
		if ($_SESSION['uid'])
		{
			$adminloginlink .= 'clientssummary.php?userid=' . $_SESSION['uid'];
		}

		$adminloginlink .= '" style="color:#6699ff; decoration: none;">Return to Admin Area</a> | <a href="../" target="_blank" style="color:#6699ff; decoration: none;">Front Area</a> | <a href="http://www.yagbu.net" target="_blank" style="color:#6699ff; decoration: none;">Visit Yagbu.net</a> </div>

';
	}
	else
	{
		$adminloginlink = '';
	}

	if ($smartyvalues)
	{
		foreach ($smartyvalues as $key => $value)
		{
			$smarty->assign ($key, $value);
		}
	}

	run_hook ('ClientAreaPage', array ());
	$header_file = $smarty->fetch ($CONFIG['Template'] . '/header.tpl');
	$footer_file = $smarty->fetch ($CONFIG['Template'] . '/footer.tpl');
	if ($orderform)
	{
		$body_file = $smarty->fetch ('orderforms/' . $CONFIG['OrderFormTemplate'] . '/' . $templatefile . '.tpl');
	}
	else
	{
		if ($usingsupportmodule)
		{
			$body_file = $smarty->fetch ($CONFIG['SupportModule'] . '/' . $templatefile . '.tpl');
		}
		else
		{
			$body_file = $smarty->fetch ($CONFIG['Template'] . '/' . $templatefile . '.tpl');
		}
	}

	$template_output = $header_file . $body_file . $copyrighttext . $adminloginlink . $footer_file;
	echo $template_output;
}

?>